package com.winter.common.dynamic.datasource.service;

import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DataSourceProperty;

import java.util.Map;

public interface DataSourceService {
    /**
     * 获取当前所有数据源
     * @return
     */
    Map listCurrentDataSource();
    /**
     * 新增数据源
     * @param dataSourceProperty
     * @return
     */
    boolean addDataSource(DataSourceProperty dataSourceProperty);
    boolean removeDataSource(String alias) throws NoSuchFieldException, IllegalAccessException;
    /**
     * 获取默认数据源信息
     * @return
     */
    DataSourceProperty defaultDataSource();
    /**
     * 获取当前数据源信息
     * @return
     */
    DataSourceProperty currentDataSource();
    /**
     * 切换默认数据源
     * @param alias
     * @return
     */
    boolean setDefaultDataSource(String alias);
}
